package com.epfly.promo.activity.dao;

import com.epfly.promo.activity.entity.ActivityFoodCategoryEntity;
import org.apache.ibatis.annotations.*;
import tk.mybatis.mapper.additional.insert.InsertListMapper;
import tk.mybatis.mapper.common.BaseMapper;

import java.util.List;

@Mapper
public interface ActivityFoodCategoryMapper extends BaseMapper<ActivityFoodCategoryEntity>, InsertListMapper<ActivityFoodCategoryEntity> {


    @Update(value = "delete from tbl_activity_food_category where activity_id = #{activityId} and del_flag = 0")
    int deleteByActivityId(@Param(value = "activityId") Long activityId);





    @ResultMap(value = "activityFoodCategoryMapperBaseResultMap")
    @Select(value = "select relation_id from tbl_activity_food_category where activity_id = #{activityId} and del_flag = 0 ")
    List<ActivityFoodCategoryEntity> findByActivityId(@Param(value = "activityId") Long activityId);

    ActivityFoodCategoryEntity existsByActivityIdAndFoodCategoryIdList(@Param(value = "activityId") Long activityId, @Param(value = "foodCategoryIdList") List<String> foodCategoryIdList);


    List<String> findByActivityIdAndFoodCategoryIdList(@Param(value = "activityId") Long activityId, @Param(value = "foodCategoryIdList") List<String> foodCategoryIdList);
}
